package com.atguigu.vod.config;

import com.aliyun.vod.upload.UploadVideo;
import com.aliyun.vod.upload.impl.UploadVideoImpl;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.DeleteVideoRequest;
import com.aliyuncs.vod.model.v20170321.DeleteVideoResponse;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Summerday
 */

@Configuration
public class VodConfig {

    @Value("${aliyun.vod.file.accessKeyId}")
    private String accessKeyId;
    @Value("${aliyun.vod.file.accessKeySecret}")
    private String accessKeySecret;
    /**
     * 点播服务接入区域
     */
    @Value("${aliyun.vod.file.regionId}")
    private String regionId;


    @Bean
    public UploadVideo uploadVideo() {
        return new UploadVideoImpl();
    }

    @Bean
    public DefaultAcsClient defaultAcsClient() {
        //String regionId = "cn-shanghai";  //
        DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
        return new DefaultAcsClient(profile);
    }

    @Bean
    public DeleteVideoRequest deleteVideoRequest() {
        return new DeleteVideoRequest();
    }

    @Bean
    public GetVideoPlayAuthRequest getVideoPlayAuthRequest(){
        return new GetVideoPlayAuthRequest();
    }

    @Bean
    public DeleteVideoResponse deleteVideoResponse() {
        return new DeleteVideoResponse();
    }


    public String getAccessKeyId() {
        return accessKeyId;
    }

    public void setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
    }

    public String getAccessKeySecret() {
        return accessKeySecret;
    }

    public void setAccessKeySecret(String accessKeySecret) {
        this.accessKeySecret = accessKeySecret;
    }
}
